/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package engine;

import java.util.ArrayList;
import java.util.List;
import server.ServeOneThread;
import webClient.HttpClient.SocketProcessor;
import org.apache.log4j.Logger;

/**
 *
 * @author Alexx
 */
public class Singleton {
  private static final Logger log = Logger.getLogger(Singleton.class);
  private static Singleton instance;
 // public static List<String> users = new ArrayList<String>();
  public static String out;
  public static List<String> Clientusers = new ArrayList<String>();
  public static String outClient = "";
  public static List<Player> clients = new ArrayList<Player>();
  public static Soluter sol;
  public static List<Soluter> sol2 = new ArrayList<Soluter>();
  public static SocketProcessor sok;
  public static String status = "<meta HTTP-EQUIV=\"Refresh\" Content=\"1; URL=http://localhost:7777/update\">"
          + "<html><body><h2>Еще нет ответа</h2>"
         // + "<h1><a href=\"update\">Обновить</a> </h1>"
          + "</body></html>";
  public static int[][] fig = new int[3][3];
  public static String gameStatus = "Нет игры";
  public static boolean spaly = false;
  public static String invite = "";
  public static int[][] fig2 = new int[3][3];
  
  private Singleton() {
    
  }
  
  public static Singleton getInstance() {
    if (instance == null) {
      instance = new Singleton();
    }
    return instance;  
  }
  
  public void setUser(String user)
  {
    int s = clients.size()-1;
    clients.get(s).setLogin(user);
    log.debug("set playyer " + s + " get name " + clients.get(s).getLogin());
  }
  
  public void delUser(String user)
  {
    int count = 0;
    int delPos = 0;
    boolean flag = false;
    for (Player s : clients)
    {
      if(s.getLogin() == user){
        delPos = count;
        flag = true;
      }
      count++;
    }
    if (flag){
    clients.remove(delPos);
    }
   // users.add(user);
  }
}
